<!doctype HTML>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
selection_test(
  [  '<div contenteditable><table contenteditable="false"><tbody>',
       '<tr><td contenteditable id="target">f^ooba|r</td></tr>',
      '</tbody></table></div>',
      '<div contenteditable id="destination"></div>' ],
  selection => {
    if (!window.eventSender) {
      assert_no_reached('This test requires eventSender.');
      return;
    }
    const target = selection.document.querySelector('#target');
    eventSender.mouseMoveTo(selection.computeLeft(target) + target.offsetWidth / 2,
      selection.computeTop(target) + target.offsetHeight / 2);
    eventSender.mouseDown();
    eventSender.leapForward(1000);
    const dest = selection.document.querySelector('#destination');
    eventSender.mouseMoveTo(selection.computeLeft(dest) + dest.offsetWidth / 2,
      selection.computeTop(dest) + dest.offsetHeight / 2);
    eventSender.mouseUp();
  },
  [  '<div contenteditable><table contenteditable="false"><tbody>',
       '<tr><td contenteditable id="target">fr</td></tr>',
      '</tbody></table></div>',
      '<div contenteditable id="destination">^ooba|</div>' ],
  'Drag contenteditable node in not contenteditable table');
</script>
